var a = require("../../../@babel/runtime/helpers/defineProperty"), t = getApp();

Page({
    data: {
        Data: {},
        language: "",
        datasource: [],
        balance_special: !1,
        unAllCheckList: [],
        allCheckList: [],
        isCheckAll: !1,
        isAlipay: !1,
        alipay: {},
        isWechat: !1,
        wechat: {},
        isWorkerWeachat: !1,
        worker_withdraw_wechat: {},
        isWorkerAlipy: !1,
        worker_withdraw_alipay: {},
        isWorkerBank: !1,
        worker_withdraw_bank: {},
        isBalance: !1,
        balance: {},
        isManual: !1,
        manual: {},
        isHx: !1,
        huanxun: {},
        isEup: !1,
        eup: {},
        action: "",
        msg: "",
        notice: "",
        totalwithdrawal: 0,
        poundage: 0,
        servicetax: 0,
        independent_special: 0,
        independent_poundage: 0,
        checkAll: !1,
        checkList: [],
        show1: !1,
        pay_type: "",
        clicktag: 0,
        isyop_pay: !1,
        yop_pay: {},
        converge_pay_json: {},
        isHj: !1,
        show2: !1,
        show3: !1,
        withList: [],
        checkObj: {},
        poundage_hj: "",
        actual_amount: "",
        special_service_tax_text: "",
        income_name_text: "",
        service_switch: 0,
        name_of_withdrawal: "",
        poundage_name: "",
        deduction_love: {},
        TeamDividendModel: !1,
        income_type: null,
        withTypeList: [],
        bankdata: {
            bankname: "",
            Province: "",
            city: "",
            branchName: "",
            card: "",
            name: ""
        },
        posRightShow: !1,
        provinceData: [],
        cityData: [],
        showCityData: [],
        ProvinceId: "",
        addressShow_p: !1,
        addressShow_c: !1,
        pay_typeList: {},
        stickStatus: !1,
        customer_service: {},
        withdraw_rich_text: {},
        customer_show: !1,
        withdraw_rich_show: !1,
        setWX: !1,
        setAlipay: !1,
        setinWX: "",
        setinAlipay: "",
        setinAlipayName: "",
        eplus_withdraw_bank: [],
        show: !1,
        list: []
    },
    onLoad: function(a) {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onReady: function() {
        var a = wx.getStorageSync("langIndex");
        this.setData({
            language: a.en
        });
    },
    stickChange: function(a) {
        this.setData({
            stickStatus: a.detail.isFixed
        });
    },
    onShow: function() {
        this._intData(), this._getData(), this._initHxpay(), this.customizeIncome();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    gotoChat: function(a) {
        var e = a.currentTarget.dataset.cservice;
        console.log(a), wx.navigateTo({
            url: e,
            fail: function(a) {
                t.tips("客服路由出错");
            }
        });
    },
    setInput: function(a) {
        var t = a.detail, e = a.currentTarget.dataset.key;
        "wxuser" == e ? this.setData({
            setinWX: t
        }) : "Alipay" == e ? this.setData({
            setinAlipay: t
        }) : "AlipayName" == e && this.setData({
            setinAlipayName: t
        });
    },
    bindSet: function(a) {
        var e = this;
        console.log(a);
        var i = {};
        if ("wx" == a.currentTarget.dataset.key) {
            if (t._isTextEmpty(this.data.setinWX)) return void t.tips("请输入微信号");
            i.wx = this.data.setinWX;
        } else {
            if (t._isTextEmpty(this.data.setinAlipay)) return void t.tips("请输入支付宝账号");
            if (t._isTextEmpty(this.data.setinAlipayName)) return void t.tips("请输入支付宝账号姓名");
            i.alipay = this.data.setinAlipay, i.alipay_name = this.data.setinAlipayName;
        }
        var n = t.getNetAddresss("member.member.updateWxOrAli");
        t._postNetWork({
            url: n,
            data: i,
            success: function(a) {
                var i = a.data;
                i.result, e.setData({
                    setAlipay: !1,
                    setWX: !1
                }), t.tips(i.msg);
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    _intData: function() {
        this.setData({
            income_type: null,
            Data: {},
            datasource: [],
            balance_special: !1,
            unAllCheckList: [],
            allCheckList: [],
            isCheckAll: !1,
            isAlipay: !1,
            alipay: {},
            isWechat: !1,
            wechat: {},
            isBalance: !1,
            balance: {},
            isManual: !1,
            manual: {},
            isHx: !1,
            isEup: !1,
            eup: {},
            action: "",
            msg: "",
            notice: "",
            totalwithdrawal: 0,
            poundage: 0,
            servicetax: 0,
            independent_special: 0,
            independent_poundage: 0,
            checkAll: !1,
            checkList: [],
            show1: !1,
            pay_type: "",
            clicktag: 0,
            isyop_pay: !1,
            yop_pay: {},
            posRightShow: !1,
            show: !1
        });
    },
    _getData: function() {
        var a = this, e = t.getNetAddresss("finance.income-withdraw.get-withdraw");
        t._getNetWork({
            url: e,
            data: {
                validate_page: 1
            },
            success: function(t) {
                var e = t.data;
                if (1 == e.result) {
                    if (e.data.need_sign) return void wx.showModal({
                        title: "提示",
                        content: "请先完成合同签署",
                        success: function(a) {
                            a.confirm && wx.navigateTo({
                                url: "/packageH/sign_shopV2/index/index?scene=2"
                            });
                        }
                    });
                    a.setData({
                        balance_special: e.data.setting.balance_special,
                        datasource: e.data.data,
                        service_switch: e.data.setting.service_switch,
                        all_withdraw_income: e.data.all_withdraw_income ? e.data.all_withdraw_income.toFixed(2) : "",
                        customer_service: e.data.setting.customer_service,
                        withdraw_rich_text: e.data.setting.withdraw_rich_text
                    }), e.data.deduction_love && a.setData({
                        deduction_love: e.data.deduction_love
                    }), a.setData({
                        Data: e.data.data
                    }), a.data.Data.length > 0 ? a._allCheckListInit(e.data.data) : wx.showToast({
                        icon: "none",
                        title: "暂无可".concat(a.data.name_of_withdrawal, "金额"),
                        duration: 1500
                    });
                } else a.setData({
                    Data: []
                }), wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getGconverge_pay: function(a) {
        var e = this, i = t.getNetAddresss("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.get-bank-card");
        t._getNetWork({
            url: i,
            success: function(a) {
                var t = a.data;
                if (1 == t.result) {
                    e.setData({
                        show2: !0,
                        show1: !1
                    }), e.setData({
                        converge_pay_json: t.data
                    }), e.setData({
                        checkObj: t.data
                    });
                    var i = t.data.bankName + "(" + t.data.receiverAccountNoEnc.substring(t.data.receiverAccountNoEnc.length - 4) + ")";
                    e.setData({
                        "checkObj.bankName": i
                    }), e.getwithList();
                } else wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1500
                }), setTimeout(function() {
                    wx.navigateTo({
                        url: "/packageA/others/HJinfo/bankCardInformation/bankCardInformation"
                    });
                }, 2e3);
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    eplusClose: function() {
        this.setData({
            clicktag: 0,
            show: !1
        });
    },
    eplus_withdrawal: function() {
        return 0 == this.data.eplus_withdraw_bank.extra_data.is_auth ? void wx.showModal({
            content: "请先完成认证",
            showCancel: !1,
            success: function() {
                wx.navigateTo({
                    url: "/packageF/others/wisdom/wisdomBindTask/wisdomBindTask"
                });
            }
        }) : (this._countTotalPrice(), void this.getBankList());
    },
    onConfirm: function(a) {
        console.log(a, "dddddddddd"), a.detail.radio ? this.withdrawToBalance(this.data.pay_type, a.detail.radio) : wx.showModal({
            content: "请选择银行卡",
            showCancel: !1
        });
    },
    getBankList: function() {
        var a = this, e = t.getNetAddresss("plugin.eplus-pay.frontend.card.bindCardList");
        t._getNetWork({
            url: e,
            success: function(e) {
                var i = e.data;
                1 == i.result ? a.setData({
                    show: !0,
                    list: i.data
                }) : t.tips(i.msg);
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getwithList: function() {
        var a = this, e = t.getNetAddresss("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.get-bank-card-list");
        t._getNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                1 == e.result ? (0 == e.data.length && (wx.showToast({
                    title: "请先去添加银行卡",
                    icon: "none"
                }), wx.navigateTo({
                    url: "/packageA/others/HJinfo/bankCardInformation/bankCardInformation"
                })), e.data.map(function(a) {
                    a.check = !1, "" != a.receiverAccountNoEnc && null != a.receiverAccountNoEnc && (a.bankName += "(" + a.receiverAccountNoEnc.substring(a.receiverAccountNoEnc.length - 4) + ")");
                }), a.setData({
                    withList: e.data
                })) : (wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                }), setTimeout(function() {}, 2e3));
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    gotoList: function() {
        console.log("22333121"), this.setData({
            show3: !0,
            show2: !1
        });
    },
    _allCheckListInit: function(a) {
        for (var t = 0; t < a.length; t++) if (a[t].can) {
            if ("default" === a[t].income_type) {
                var e = this.data.allCheckList;
                e.push(t + ""), this.setData({
                    allCheckList: e
                });
            }
        } else {
            var i = this.data.unAllCheckList;
            i.push(t + ""), this.setData({
                unAllCheckList: i
            });
        }
        this.setData({
            isCheckAll: !(this.data.unAllCheckList.length === this.data.datasource.length)
        });
    },
    getMergeServicetax: function() {
        var a = this;
        if (this.data.income_type) {
            for (var e = [], i = this.data.checkList, n = 0; n < i.length; n++) e.push(this.data.datasource[i[n]].key_name);
            var s = t.getNetAddresss("finance.income-withdraw.getMergeServicetax");
            t._postNetWork({
                url: s,
                data: {
                    income_type: e
                },
                success: function(t) {
                    var e = t.data;
                    1 == e.result && (a.setData({
                        totalwithdrawal: e.data.sum_amount,
                        poundage: e.data.poundage_amount,
                        servicetax: e.data.servicetax_amount
                    }), a.checkPayWay());
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        } else wx.showToast({
            icon: "none",
            title: "请先选择".concat(this.data.name_of_withdrawal, "类型"),
            duration: 1500
        });
    },
    _getWithdrawType: function() {
        var a = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0], e = this, i = t.getNetAddresss("finance.income-withdraw.get-income-withdraw-mode");
        t._getNetWork({
            url: i,
            data: {
                income_type: e.data.income_type
            },
            success: function(t) {
                var i = t.data;
                1 == i.result && (a && e.setData({
                    show1: !0
                }), e.setData({
                    pay_typeList: i.data
                }), e._initWithdrawType(i.data));
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    backGo: function() {
        this.setData({
            show2: !0,
            show1: !1,
            show3: !1
        });
    },
    backTap: function() {
        this.setData({
            show2: !1,
            show1: !0,
            show3: !1
        });
    },
    _initWithdrawType: function(a) {
        this.setData({
            service_switch: a.service_switch
        }), this._initAlipay(a), this._initWechat(a), this._initBalance(a), this._initManual(a), 
        this._initEup(a), this.inityop_pay(a), console.log(a, "参数"), this.initConverge_pay(a), 
        this.initAlipayGood(a), this.initWechatGood(a), this.initBankatGood(a), this.eplus_pay(a), 
        this.silver_point_method(a);
    },
    silver_point_method: function(a) {
        a.silver_point ? this.setData({
            silverYD: !0,
            silver_point: a.silver_point
        }) : this.setData({
            silverYD: !1
        });
    },
    eplus_pay: function(a) {
        if (!a.eplus_withdraw_bank) return this.eplus = !1, void this.setData({
            eplus: !1
        });
        this.setData({
            eplus: !0,
            eplus_withdraw_bank: a.eplus_withdraw_bank
        });
    },
    initAlipayGood: function(a) {
        null != a.worker_withdraw_bank && null != a.worker_withdraw_bank && "" != a.worker_withdraw_bank ? this.setData({
            isWorkerAlipy: !0,
            worker_withdraw_bank: a.worker_withdraw_bank
        }) : this.setData({
            isWorkerAlipy: !1
        });
    },
    initWechatGood: function(a) {
        null != a.worker_withdraw_wechat && null != a.worker_withdraw_wechat && "" != a.worker_withdraw_wechat ? this.setData({
            isWorkerWeachat: !0,
            worker_withdraw_wechat: a.worker_withdraw_wechat
        }) : this.setData({
            isWorkerWeachat: !1
        });
    },
    initBankatGood: function(a) {
        null != a.worker_withdraw_bank && null != a.worker_withdraw_bank && "" != a.worker_withdraw_bank ? this.setData({
            isWorkerBank: !0,
            worker_withdraw_bank: a.worker_withdraw_bank
        }) : this.setData({
            isWorkerBank: !1
        });
    },
    _initAlipay: function(a) {
        null != a.alipay && null != a.alipay && "" != a.alipay ? this.setData({
            isAlipay: !0,
            alipay: a.alipay
        }) : this.setData({
            isAlipay: !1
        });
    },
    _initWechat: function(a) {
        null != a.wechat && null != a.wechat && "" != a.wechat ? this.setData({
            isWechat: !0,
            wechat: a.wechat
        }) : this.setData({
            isWechat: !1
        });
    },
    _initBalance: function(a) {
        null != a.balance && null != a.balance && "" != a.balance ? this.setData({
            isBalance: !0,
            balance: a.balance
        }) : this.setData({
            isBalance: !1
        });
    },
    _initManual: function(a) {
        null != a.manual && null != a.manual && "" != a.manual ? this.setData({
            isManual: !0,
            manual: a.manual
        }) : this.setData({
            isManual: !1
        });
    },
    _initEup: function(a) {
        null != a.eup_pay && null != a.eup_pay && "" != a.eup_pay ? this.setData({
            isEup: !1,
            eup: a.eup_pay
        }) : this.setData({
            isEup: !1
        });
    },
    initConverge_pay: function(a) {
        null != a.converge_pay && null != a.converge_pay && "" != a.converge_pay ? this.setData({
            isHj: !0,
            converge_pay: a.converge_pay
        }) : this.setData({
            isHj: !1
        });
    },
    _initHxpay: function() {
        this.setData({
            action: "",
            msg: "",
            notice: ""
        });
    },
    allSelect: function(a) {
        var t = !this.data.checkAll;
        this.setData({
            checkAll: t
        }), t ? this.setData({
            income_type: "default",
            checkList: this.data.allCheckList
        }) : this.setData({
            income_type: null,
            checkList: []
        }), this._countTotalPrice();
    },
    SelectHandle: function(a) {
        console.log(a, "aaa"), this.setData({
            show1: !1,
            pay_type: a.detail
        }), "worker_withdraw_bank" != this.data.pay_type && "worker_withdraw_wechat" != this.data.pay_type && "worker_withdraw_alipay" != this.data.pay_type || !this.data[this.data.pay_type] || !this.data[this.data.pay_type].extra_data || 0 != this.data[this.data.pay_type].is_register ? "silver_point" == this.data.pay_type && this.data[this.data.pay_type] && this.data[this.data.pay_type].extra_data && !this.data[this.data.pay_type].extra_data.bank_card_status ? wx.showModal({
            content: "该会员未添加默认银行卡",
            showCancel: !1,
            success: function(a) {
                a.confirm && wx.navigateTo({
                    url: "/packageA/member/memberBank/memberBank"
                });
            }
        }) : this.dynamicTxt() : "worker_withdraw_wechat" == this.data.pay_type ? wx.navigateTo({
            url: "/packageI/worker/index/index?register_type_Id=2"
        }) : wx.navigateTo({
            url: "/packageI/worker/index/index?register_type_Id=1"
        });
    },
    cardSplice: function(a) {
        var t = a.substr(0, 4), e = a.substr(a.length - 4, a.length);
        return "".concat(t, "****").concat(e);
    },
    dynamicTxt: function() {
        var a = this.data.pay_typeList;
        switch (console.log(this.data.pay_type), this.data.pay_type) {
          case "balance":
            this.setData({
                withTypeTipsIcon: "iconfont icon-fontclass-fanli",
                withTypeTipsTitle: "".concat(a.balance.name),
                withTypeTips: "通过审核后将打款到系统".concat(a.balance.other_name, "！")
            });
            break;

          case "wechat":
            this.setData({
                withTypeTipsIcon: "iconfont icon-card_weixin",
                withTypeTipsTitle: "".concat(a.wechat.name),
                withTypeTips: "通过审核后将打款到个人微信零钱！"
            });
            break;

          case "manual":
            var t = this.data.manual, e = "", i = "";
            1 == t.manual_type ? (e = "".concat(t.name, "-银行卡"), i = "通过审核后将由工作人员将打款到您的银行卡！") : 2 == t.manual_type ? (e = "".concat(t.name, "-微信"), 
            i = "通过审核后将由工作人员将打款到您的微信！") : 3 == t.manual_type && (e = "".concat(t.name, "-支付宝"), 
            i = "通过审核后将由工作人员将打款到您的支付宝！"), console.log(e), this.setData({
                withTypeTipsIcon: "iconfont icon-pay_otherpay",
                withTypeTipsTitle: e,
                withTypeTips: i
            });
            break;

          case "alipay":
            this.setData({
                withTypeTipsIcon: "iconfont icon-all_alipay",
                withTypeTipsTitle: "".concat(a.alipay.name),
                withTypeTips: "通过审核后将打款到个人支付宝！"
            });
            break;

          case "converge_pay":
            this.setData({
                withTypeTipsIcon: "iconfont icon-pay_otherpay",
                withTypeTipsTitle: "".concat(a.converge_pay.name),
                withTypeTips: "通过审核后将打款到个人银行卡！"
            });
            break;

          case "worker_withdraw_wechat":
            this.setData({
                withTypeTipsIcon: "iconfont icon-balance_i",
                withTypeTipsTitle: "微信-好灵工",
                withTypeTips: "通过审核后将打款到微信-好灵工！  "
            });
            break;

          case "worker_withdraw_alipay":
            this.setData({
                withTypeTipsIcon: "iconfont icon-icon-balance_j",
                withTypeTipsTitle: "支付宝-好灵工",
                withTypeTips: "通过审核后将打款到个人支付宝-好灵工！  "
            });
            break;

          case "worker_withdraw_bank":
            this.setData({
                withTypeTipsIcon: "iconfont icon-balance_f",
                withTypeTipsTitle: "银行卡-好灵工",
                withTypeTips: "通过审核后将打款到银行卡-好灵工！  "
            });
            break;

          case "eplus_withdraw_bank":
            this.setData({
                withTypeTipsIcon: "iconfont icon-balance_f",
                withTypeTipsTitle: "".concat(a.eplus_withdraw_bank.name),
                withTypeTips: "通过审核后将打款到个人银行卡！  "
            });
            break;

          case "silver_point":
            this.setData({
                withTypeTipsIcon: "iconfont icon-balance_f",
                withTypeTipsTitle: "银行卡-银典支付",
                withTypeTips: "通过审核后将打款到个人银行卡！  "
            });
            break;

          default:
            this.pay_type = "";
        }
    },
    allSelectHandle: function(a) {
        var t = a.detail, e = t.length;
        t.length > 0 ? this.setData({
            income_type: this.data.datasource[t[0]].income_type
        }) : this.setData({
            income_type: null
        }), this.setData({
            checkList: t,
            checkAll: e === this.data.allCheckList.length
        }), this._countTotalPrice();
    },
    _countTotalPrice: function() {
        var a = this.data.checkList;
        this.setData({
            totalwithdrawal: 0,
            poundage: 0,
            servicetax: 0,
            independent_special: 0,
            independent_poundage: 0,
            actual_amount: 0,
            poundage_hj: 0
        }), this.setData({
            TeamDividendModel: !1
        });
        for (var t = 0; t < a.length; t++) this.setData({
            totalwithdrawal: this.floatAdd(this.data.totalwithdrawal, this.data.datasource[a[t]].income),
            poundage: this.floatAdd(this.data.poundage, this.data.datasource[a[t]].poundage),
            servicetax: this.floatAdd(this.data.servicetax, this.data.datasource[a[t]].servicetax),
            actual_amount: this.floatAdd(this.data.actual_amount, this.data.datasource[a[t]].actual_amount),
            poundage_hj: this.floatAdd(this.data.poundage_hj, this.data.datasource[a[t]].poundage)
        }), this.data.datasource[a[t]].type.indexOf("TeamDividendModel") >= 0 && this.setData({
            TeamDividendModel: !0
        }), this.data.balance_special && this.setData({
            independent_special: this.floatAdd(this.data.independent_special, this.data.datasource[a[t]].special_service_tax),
            independent_poundage: this.floatAdd(this.data.independent_poundage, this.data.datasource[a[t]].special_poundage)
        });
        this.setData({
            totalwithdrawal: Number(this.data.totalwithdrawal.toString()).toFixed(2),
            poundage: Number(this.data.poundage.toString()).toFixed(2),
            servicetax: Number(this.data.servicetax.toString()).toFixed(2)
        }), this.data.balance_special && this.setData({
            independent_special: Number(this.data.independent_special.toString().match(/^\d+(?:\.\d{0,2})?/)),
            independent_poundage: Number(this.data.independent_poundage.toString().match(/^\d+(?:\.\d{0,2})?/))
        });
    },
    floatAdd: function(a, t) {
        var e, i, n;
        try {
            e = a.split(".")[1].length;
        } catch (a) {
            e = 0;
        }
        try {
            i = t.split(".")[1].length;
        } catch (a) {
            i = 0;
        }
        return (a * (n = Math.pow(10, Math.max(e, i))) + t * n) / n;
    },
    withdrawToBalanceBtn: function(a) {
        var t = a.currentTarget.dataset.dataval;
        this.withdrawToBalance(t);
    },
    withdrawToBalance: function(a) {
        var e = this, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
        if (this._checkWithdrawToBalance()) {
            var n = this.data.checkList;
            if (n.length > 0) {
                for (var s = [], o = 0; o < n.length; o++) s.push(this.data.datasource[n[o]]);
                var c = {
                    data: {
                        total: {
                            amounts: this.data.totalwithdrawal,
                            poundage: this.data.poundage,
                            pay_way: a
                        },
                        withdrawal: s
                    }
                };
                "eplus_withdraw_bank" == a && (c.data.bank_card_no = i);
                var r = this, h = t.getNetAddresss("withdraw.apply.index");
                t._postNetWork({
                    url: h,
                    showToastIn: !1,
                    data: c,
                    success: function(t) {
                        var i = t.data;
                        1 == i.result ? (r.setData({
                            show1: !1,
                            show2: !1,
                            checkList: [],
                            totalwithdrawal: 0,
                            poundage: 0
                        }), "eplus_withdraw_bank" == a && e.setData({
                            show: !1
                        }), wx.showToast({
                            title: i.msg,
                            icon: "none",
                            duration: 1500,
                            success: function() {
                                e._getData();
                            }
                        })) : wx.showModal({
                            title: "提示",
                            content: i.msg,
                            success: function(a) {
                                a.confirm && (1 == i.data.status && wx.navigateTo({
                                    url: "/packageA/member/info/info"
                                }), 1 == i.data.love && wx.navigateTo({
                                    url: "/packageB/member/love/Love_index/Love_index"
                                }));
                            }
                        }), setTimeout(function() {
                            r.setData({
                                clicktag: 0
                            });
                        }, 1e3);
                    },
                    fail: function(a) {
                        wx.showToast({
                            icon: "none",
                            title: a,
                            duration: 1500
                        }), setTimeout(function() {
                            r.setData({
                                clicktag: 0
                            });
                        }, 1e3);
                    }
                });
            } else wx.showToast({
                icon: "".concat(that.data.name_of_withdrawal, "数据不可为空"),
                title: res,
                duration: 1500
            }), that.setData({
                clicktag: 0
            });
        }
    },
    _checkWithdrawToBalance: function() {
        return !(parseFloat(this.data.totalwithdrawal) <= 0 || null == this.data.totalwithdrawal) || (wx.showToast({
            icon: "none",
            title: "".concat(this.data.name_of_withdrawal, "金额不能等于0"),
            duration: 1500
        }), this.setData({
            clicktag: 0
        }), !1);
    },
    checkManual: function(a) {
        var e = a;
        if (console.log(this._checkWithdrawToBalance()), this._checkWithdrawToBalance()) {
            var i = this, n = t.getNetAddresss("finance.manual-type.is-can-submit");
            t._postNetWork({
                url: n,
                showToastIn: !1,
                data: {},
                success: function(a) {
                    var t = a.data;
                    1 == t.result ? t.data.status ? i.withdrawToBalance(e) : i.setManualInfo(e, t.data.manual_type) : wx.showToast({
                        icon: "none",
                        title: t.msg,
                        duration: 1500
                    });
                },
                fail: function(a) {
                    wx.showToast({
                        icon: "none",
                        title: a,
                        duration: 1500
                    });
                }
            });
        }
    },
    setManualInfo: function(a, t) {
        var e = "", i = this;
        switch (t) {
          case "bank":
            e = "请先填写银行卡信息";
            break;

          case "wechat":
            e = "请先填写微信信息";
            break;

          case "alipay":
            e = "请先填写支付宝信息";
        }
        wx.showModal({
            title: "提示",
            content: e,
            success: function(a) {
                a.confirm ? "bank" == t ? i.getBankCard() : "wechat" == t ? i.setData({
                    setWX: !0,
                    clicktag: 0
                }) : i.setData({
                    setAlipay: !0,
                    clicktag: 0
                }) : a.cancel && (i.setData({
                    clicktag: 0
                }), console.log("用户点击取消"));
            }
        });
    },
    editUser: function() {
        this.getBankCard();
    },
    onCancel: function() {
        this.setData({
            createCardShow: !0,
            addressShow_p: !1,
            addressShow_c: !1
        });
    },
    addressCallback: function(a) {
        console.log(a), this.setData({
            "bankdata.Province": a.detail.value.areaname,
            ProvinceId: a.detail.value.id,
            showCityData: [],
            "bankdata.city": ""
        }), this.onCancel();
    },
    addressCallback_c: function(a) {
        this.setData({
            "bankdata.city": a.detail.value.areaname
        }), this.onCancel();
    },
    addressShowCity: function() {
        if (this.data.ProvinceId) for (var a = 0; a < this.data.cityData.length; a++) this.data.cityData[a].parentid == this.data.ProvinceId && this.setData({
            showCityData: this.data.showCityData.concat(this.data.cityData[a]),
            createCardShow: !1,
            addressShow_c: !0
        }); else wx.showToast({
            title: "请先选择省",
            icon: "none",
            duration: 1e3
        });
    },
    addressShowProvince: function() {
        var a = this;
        if (this.data.provinceData.length > 0) this.setData({
            createCardShow: !1,
            addressShow_p: !0
        }); else {
            var e = t.getNetAddresss("member.member-address.address");
            t._postNetWork({
                url: e,
                showToastIn: !1,
                data: this.data.form,
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? a.setData({
                        provinceData: e.data.province,
                        cityData: e.data.city,
                        createCardShow: !1,
                        addressShow_p: !0
                    }) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        }
    },
    getBankCard: function() {
        var a = this, e = t.getNetAddresss("member.bank-card.show");
        t._postNetWork({
            url: e,
            showToastIn: !1,
            data: this.data.form,
            success: function(t) {
                var e = t.data;
                1 == e.result ? a.setData({
                    "bankdata.bankname": e.data.bank_name,
                    "bankdata.card": e.data.bank_card,
                    "bankdata.name": e.data.member_name,
                    "bankdata.Province": e.data.bank_province,
                    "bankdata.city": e.data.bank_city,
                    "bankdata.branchName": e.data.bank_branch,
                    createCardShow: !0,
                    clicktag: 0
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    tapinpbank: function(t) {
        var e = t.currentTarget.dataset.key, i = t.detail;
        this.setData(a({}, "bankdata." + e, i));
    },
    bindCard: function() {
        var a = this;
        if (console.log(this.data.bankdata), t._isTextEmpty(this.data.bankdata.bankname)) wx.showToast({
            icon: "none",
            title: "请输入开户行",
            duration: 1500
        }); else if (t._isTextEmpty(this.data.bankdata.Province)) wx.showToast({
            icon: "none",
            title: "请输入开户行省份",
            duration: 1500
        }); else if (t._isTextEmpty(this.data.bankdata.city)) wx.showToast({
            icon: "none",
            title: "请输入开户行城市",
            duration: 1500
        }); else if (t._isTextEmpty(this.data.bankdata.branchName)) wx.showToast({
            icon: "none",
            title: "请输入开户行支行",
            duration: 1500
        }); else if (t._isTextEmpty(this.data.bankdata.card)) wx.showToast({
            icon: "none",
            title: "请输入账号",
            duration: 1500
        }); else if (t._isTextEmpty(this.data.bankdata.name)) wx.showToast({
            icon: "none",
            title: "请输入姓名",
            duration: 1500
        }); else {
            var e = {
                bank_card: this.data.bankdata.card,
                member_name: this.data.bankdata.name,
                bank_name: this.data.bankdata.bankname,
                bank_province: this.data.bankdata.Province,
                bank_city: this.data.bankdata.city,
                bank_branch: this.data.bankdata.branchName
            }, i = t.getNetAddresss("member.bank-card.edit");
            t._postNetWork({
                url: i,
                showToastIn: !1,
                data: e,
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? wx.showToast({
                        title: e.msg,
                        icon: "none",
                        duration: 1e3,
                        success: function(t) {
                            a.setData({
                                createCardShow: !1,
                                addressShow_c: !1,
                                addressShow_p: !1
                            }), console.log(t, "sssssssssss"), a._getWithdrawType(!1);
                        }
                    }) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(a) {
                    console.log(a.msg);
                }
            });
        }
    },
    checkEup: function(a) {
        var e = a;
        if (this._checkWithdrawToBalance()) {
            var i = this, n = t.getNetAddresss("plugin.eup-pay.api.account.pi-account");
            t._postNetWork({
                url: n,
                showToastIn: !1,
                data: {},
                success: function(a) {
                    var t = a.data;
                    if (1 == t.result) 1 == t.data.bool && i.withdrawToBalance(e); else if (0 == t.result && 0 == t.data.bool) {
                        var n = t.msg;
                        wx.showModal({
                            title: "提示",
                            content: n,
                            success: function(a) {
                                a.confirm ? wx.navigateTo({
                                    url: "/packageA/member/info/info"
                                }) : a.cancel && console.log("用户点击取消");
                            }
                        });
                    }
                },
                fail: function(a) {
                    wx.showToast({
                        icon: "none",
                        title: a,
                        duration: 1500
                    });
                }
            });
        }
    },
    getToTitle: function() {
        var a = this, e = t.getNetAddresss("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.set-bank-card");
        t._postNetWork({
            url: e,
            data: {
                set: this.data.checkObj
            },
            success: function(t) {
                var e = t.data;
                if (1 == e.result) {
                    a.withdrawToBalance("converge_pay");
                } else wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    withBalance: function() {
        console.log(this.data.checkObj, "选择的对象"), this.getToTitle();
    },
    onChange: function(a) {
        console.log(a.detail, "改变啊啊啊");
    },
    checkOut: function(a) {
        var t = a.target.dataset.item || a.currentTarget.dataset.item;
        t.check = !t.check, console.log(t, "当前对象");
        var e = this.data.withList;
        e.map(function(a) {
            a.id == t.id ? a.check = t.check : a.check = !1;
        }), console.log(e, "数组"), 1 == t.check && this.setData({
            show3: !1,
            show2: !0,
            checkObj: t,
            withList: e
        });
    },
    tapShow: function() {
        this.setData({
            posRightShow: !this.data.posRightShow
        });
    },
    onClickLeft: function(a) {
        this.setData({
            withdraw_rich_show: !1,
            customer_show: !1
        });
    },
    toRecord: function(a) {
        console.log(a);
        var t = a.currentTarget.dataset.path;
        "presentationRecord_v2" == t ? wx.navigateTo({
            url: "/packageA/member/presentationRecord_v2/presentationRecord_v2?orderType=extension"
        }) : "fa_child" == t ? this.setData({
            withdraw_rich_show: !0
        }) : this.setData({
            customer_show: !0
        }), this.setData({
            posRightShow: !1
        });
    },
    submitbrank: function() {
        t._postNetWork({
            url: this.data.action,
            showToastIn: !1,
            data: {
                ipsRequest: this.data.msg
            },
            success: function(a) {
                wx.navigateBack({
                    delta: 1
                });
            },
            fail: function(a) {}
        });
    },
    show1btn: function() {
        this.setData({
            show1: !0
        });
    },
    show1CloseBtn: function() {
        this.setData({
            show1: !1,
            show2: !1,
            show3: !1,
            setWX: !1,
            setAlipay: !1,
            createCardShow: !1
        });
    },
    payTypebtn: function(a) {
        var t = a.detail;
        this.setData({
            pay_type: t
        });
    },
    checkPayWay: function() {
        if (console.log(this.data.pay_type, this.data.clicktag), this.data.pay_type) {
            if ("converge_pay" == this.data.pay_type && 1 == this.data.clicktag && this.getGconverge_pay(this.data.yop_pay), 
            0 === this.data.clicktag) switch (this.setData({
                clicktag: 1
            }), this.data.pay_type) {
              case "balance":
              case "silver_point":
              case "wechat":
                this.withdrawToBalance(this.data.pay_type);
                break;

              case "manual":
                this.checkManual(this.data.pay_type);
                break;

              case "alipay":
              case "worker_withdraw_wechat":
              case "worker_withdraw_alipay":
              case "worker_withdraw_bank":
                this.withdrawToBalance(this.data.pay_type);
                break;

              case "eup":
                this.checkEup(this.data.pay_type);
                break;

              case "yop_pay":
                this.checkyop_pay(this.data.yop_pay);
                break;

              case "converge_pay":
                this.getGconverge_pay(this.data.pay_type);
                break;

              case "eplus_withdraw_bank":
                this.eplus_withdrawal(this.data.pay_type);
                break;

              default:
                this.checkEup(this.pay_type);
            }
        } else wx.showToast({
            icon: "none",
            title: "请选择".concat(this.data.name_of_withdrawal, "方式")
        });
    },
    inityop_pay: function(a) {
        null != a.yop_pay && null != a.wechat && "" != a.yop_pay ? this.setData({
            isyop_pay: !0,
            yop_pay: a.yop_pay
        }) : this.setData({
            isyop_pay: !1
        });
    },
    checkyop_pay: function(a) {
        if (this._checkWithdrawToBalance()) {
            var e = this, i = t.getNetAddresss("plugin.yop-pay.api.yop-verification");
            t._getNetWork({
                url: i,
                success: function(t) {
                    var i = t.data;
                    1 == i.result ? e.withdrawToBalance(a) : wx.showToast({
                        title: i.msg,
                        icon: "none",
                        duration: 1500,
                        success: function() {
                            setTimeout(function() {
                                wx.navigateTo({
                                    url: "/packageA/member/info/info"
                                });
                            }, 1500);
                        }
                    });
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        }
    },
    customizeIncome: function() {
        try {
            var a = wx.getStorageSync("mailLanguage");
            if (a) {
                var t = JSON.parse(a);
                this.setData({
                    special_service_tax_text: t.income.special_service_tax,
                    income_name_text: t.income.income_name,
                    name_of_withdrawal: t.income.name_of_withdrawal,
                    poundage_name: t.income.poundage_name
                });
            }
        } catch (a) {}
    }
});